var e = getApp(),
    o = require("../../../utils/core");
Page({

    /**
     * 页面的初始数据
     */
    data: {
        currentTab: 0,
        list: [],
        listleft: [],
        listright: []
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (el) {
        e.checkAuth()
        var that = this
        that.setData({
            currentTab: el.currentTab
        })
        if (that.data.currentTab == 0) {
            o.post('goods.libaock', {}, ((e) => {
                that.setData({
                    list: e
                })
            }))
        } else {
            that.data.currentTab == 1 ?
                o.post('goods.libaomd', {}, ((e) => {
                    that.setData({
                        list: e
                    })
                })) :
                o.post('goods.libaock', {}, ((e) => {
                    that.setData({
                        list: e
                    })
                }))

        }
    },
    changecss: function (e) {
        //获取当前点击元素传进来的值
        var that = this
        var cur = e.target.dataset.current;
        that.setData({
            currentTab: cur
        })
        if (cur == 0) {
            o.post('goods.libaock', {}, ((e) => {
                that.setData({
                    list: e
                })
            }))
        } else if (cur == 1) {
            o.post('goods.libaomd', {}, ((e) => {
                that.setData({
                    list: e
                })
            }))
        }
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {
        return o.onShareAppMessage();
    }
})